﻿@using Company.Project.Domain.Model
@using Company.Project.Domain.Model.DTO.Manager
@{
    var ModuleList = (List<MenuModuleListDTO>)ViewBag.ModuleList;
}
@model Project_SYS_Role
@Html.HiddenFor(x => x.ID)

<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right"><span style="color: red">*</span>角色名称</label>
    <div class="col-sm-9">
        <div class="clearfix">
            <input type="text" id="RoleName" name="RoleName" required maxlength="20" value="@Model.RoleName" placeholder="请输入角色名称" class="col-xs-10 col-sm-5">
        </div>
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right">角色描述</label>
    <div class="col-sm-9">
        <div class="clearfix">
            <input type="text" id="Memo" name="Memo" value="@Model.Memo" maxlength="50" placeholder="请输入角色描述" class="col-xs-10 col-sm-5">
        </div>
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right"><span style="color: red">*</span>排序编号</label>
    <div class="col-sm-9">
        <div class="clearfix">
            <input type="text" id="OrderID" name="OrderID" required maxlength="9" digits="true" value="@(Model.OrderID)" placeholder="请输入排序编号" class="col-xs-10 col-sm-5">
        </div>
    </div>
</div>
@{
    foreach (var MainModule in ModuleList)
    {
        <div class="form-group moduleList">
            <div class="col-sm-12 title">
                <h4>@MainModule.ModuleName</h4>
            </div>
            @foreach (var ChildModule in MainModule.ChildModule)
            {
                <div class="col-sm-11">
                    <h5 style="float: left; width: 150px; text-align: right">@ChildModule.ModuleName</h5>
                    @if (ChildModule.ChildAction.Any())
                    {
                        <div class="contents">
                            <ul>
                                @foreach (var action in ChildModule.ChildAction)
                                {
                                    <li>
                                        <label>
                                            @if (action.IsMenu)
                                            {
                                                <input type="checkbox" @Html.Raw(action.IsCheck ? "checked=\"checked\"" : "") value="@action.ID" class="ace actionid mainaction">
                                                <span class="lbl">
                                                    <strong>@action.ActionName</strong>
                                                </span>
                                            }
                                            else
                                            {
                                                <input type="checkbox" @Html.Raw(action.IsCheck ? "checked=\"checked\"" : "") value="@action.ID" class="ace actionid otheraction">
                                                <span class="lbl">
                                                    @action.ActionName
                                                </span>
                                            }
                                        </label>
                                    </li>
                                }
                            </ul>
                        </div>
                    }
                    else
                    {
                        if (ChildModule.ThreeChildModule != null && ChildModule.ThreeChildModule.Any())
                        {
                            foreach (var ThreeChildModule in ChildModule.ThreeChildModule)
                            {
                                <div class="col-sm-11">
                                    <h6 style="float: left; width: 180px; text-align: right">@ThreeChildModule.ModuleName</h6>
                                    @if (ThreeChildModule.ChildAction.Any())
                                    {
                                        <div class="contents">
                                            <ul>
                                                @foreach (var action in ThreeChildModule.ChildAction)
                                                {
                                                    <li>
                                                        <label>
                                                            @if (action.IsMenu)
                                                            {
                                                                <input type="checkbox" @Html.Raw(action.IsCheck ? "checked=\"checked\"" : "") value="@action.ID" class="ace actionid mainaction">
                                                                <span class="lbl">
                                                                    <strong>@action.ActionName</strong>
                                                                </span>
                                                            }
                                                            else
                                                            {
                                                                <input type="checkbox" @Html.Raw(action.IsCheck ? "checked=\"checked\"" : "") value="@action.ID" class="ace actionid otheraction">
                                                                <span class="lbl">
                                                                    @action.ActionName
                                                                </span>
                                                            }
                                                        </label>
                                                    </li>
                                                }
                                            </ul>
                                        </div>
                                    }
                                </div>
                            }
                        }
                    }
                </div>
            }
            <div class="col-sm-12 clear"></div>
        </div>
    }
}
<style type="text/css">
    .clear {
        clear: both;
        border-bottom: 1px dotted #e2e2e2;
    }

    .moduleList .title {
        border-bottom: 1px dotted #e2e2e2;
    }

    .moduleList .contents {
        margin-left: 10px;
        float: left;
    }

    .moduleList ul li {
        list-style-type: none;
        float: left;
        line-height: 36px;
        padding: 0px 10px;
    }
</style>
<script src="~/Areas/Admin/js/System/RoleDetail.js"></script>